package com.kxj.xfyy;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import android.content.Context;
import android.content.Intent;

public class TtsPlugin extends CordovaPlugin {

	@Override
	public boolean execute(String action, String options,
			CallbackContext callbackContext) {
		if ("OnlineSpeechSynthesis".equals(action)) {
			// 在线语音合成
			Intent intent = new Intent(getContext(),
					SpeechSynthesisService.class);
			intent.putExtra("UserText", options);
			getContext().startService(intent);
			return true;
		}
		return false;
	}

	/**
	 * 获取上下文
	 * 
	 * @return
	 */
	private Context getContext() {
		return cordova.getActivity();
	}
}
